//
//  DetailsViewController.m
//  Fragrance
//
//  Created by mark on 15/5/23.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "DetailsViewController.h"

@interface DetailsViewController ()

@end

@implementation DetailsViewController

- (void)dealloc
{
    [_model release];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor = [UIColor greenColor];
    
    [TAOverlay showOverlayWithLabel:nil Options:TAOverlayOptionAutoHide];
    

    [self creataDetailsTableView];
}

- (void)creataDetailsTableView
{
    UITableView *detailsTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width , self.view.frame.size.height - 50) style:UITableViewStylePlain];
    [self.view addSubview:detailsTableView];
    detailsTableView.delegate = self;
    detailsTableView.dataSource = self;
    [detailsTableView release];
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *indentifile = @"cell";
    DetailsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indentifile];
    if (cell == nil) {
        cell = [[DetailsTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:indentifile] ;
    }
    cell.model = self.model;
    
    UIImage *image = [UIImage imageNamed:@"beijing5"];
    UIImageView *imageview = [[UIImageView alloc] initWithImage:image];
    cell.backgroundView = imageview;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    [imageview release];
    
    return cell;
    
   
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    CGFloat height = [AutoHeight getLabelHight:20.0 :self.view.frame.size.width - 20 :self.model.desc];
    
    return 340 + 160 * self.model.picListarrayData.count + height - 30;
    
    
}





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
